CXX = g++
MODULE = main
TARGET = $(MODULE)
CFLAGS = -g -Wall -DUSE_OCL_SL
#---------------------------------------------
#   INCS / LIBS
#---------------------------------------------
UNAME := $(shell uname)

ifeq ($(UNAME), darwin)
OpenCLLIB = -L/System/Library/Frameworks/OpenCL.framework -Wl,-framework,OpenCL
else
CFLAGS += -DCL_USE_DEPRECATED_OPENCL_1_1_APIS
OpenCLLIB = -lOpenCL
endif

INCS = -I../../inc
LIBS = $(OpenCLLIB)
#---------------------------------------------
#   CFLAGS
#---------------------------------------------
#---------------------------------------------
#   SRCS / OBJS / IFILE /
#---------------------------------------------

MAINS= \
	../../src/ocl.cpp \
    main.cpp 

UTILS= 

SRCS = $(MAINS) $(UTILS)
OBJS = $(patsubst %.cpp,%.o,$(patsubst %.mm,%.o,$(SRCS)))
#---------------------------------------------
#   Build commands
#---------------------------------------------
all: $(TARGET)

$(TARGET): $(OBJS)
	$(CXX) $(CFLAGS) -o $@ $(OBJS) $(LIBS)

%.o: %.cpp
	$(CXX) $(CFLAGS) $(INCS) -o $@ -c $<

%.o: %.mm
	$(CXX) $(CFLAGS) $(INCS) -o $@ -c $<
	
clean:
	-rm -f -v $(OBJS) $(TARGET) $(MODULE).dep

depends:
	-$(CXX) $(CFLAGS) -MM $(SRCS) > $(MODULE).dep

-include $(MODULE).dep

